package main;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class Writer {
    public Wiki wiki;

    public Writer(Wiki wiki) {
        this.wiki = wiki;
    }

    public void write(String filePath) throws IOException{
        PrintWriter printWriter = new PrintWriter(new FileWriter(new File(filePath)), true);
        for(int i = 0; i < wiki.articles.size(); i++) {
            Article article = wiki.articles.get(i);
            printWriter.println(article.name);
            for (String line: article.stringsOfArticle) {
                printWriter.println(line);
            }

        }
    }
}
